package edu.uestc.canary.admin.web;

import edu.uestc.canary.entity.dto.Result;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/api/users")
public class UserController {
    @GetMapping
    public Result findByUsername(String username,String password) {
        return Result.ok(Map.of("username",username,"password",password));
    }

    @PostMapping //默认以json格式的请求体提交请求参数
    public Result findByUsername2(@RequestBody Map<String, String> params) {
        return Result.ok(params);
    }

    @PostMapping("/p") //以表单形式提交请求参数
    public Result findByUsername3(String username,String password) {
        return Result.ok(Map.of("username",username,"password",password));
    }
}
